<?php
include ('config.php');

// Tabelle Benutzer
mysql_query("CREATE TABLE IF NOT EXISTS `benutzer` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `benutzer` text NOT NULL,
  `passwort` text NOT NULL,
  `email` text NOT NULL,
  `name` text NOT NULL,
  `aktiv` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Kann DB Abfragen machen',
  `schreiben` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Kann Updates/Inserts machen',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
");

// Tabelle t1_hydranten

mysql_query("
		CREATE TABLE IF NOT EXISTS `t1_hydranten` (
  `idt1_hydranten` int(11) NOT NULL AUTO_INCREMENT,
  `type` int(11) NOT NULL,
  `position` int(11) NOT NULL,
  `diameter` int(11) NOT NULL DEFAULT '0',
  `gps_latitude` varchar(45) DEFAULT NULL,
  `gps_longtitude` varchar(45) DEFAULT NULL,
  `count` varchar(45) DEFAULT NULL,
  `comment` text COMMENT 'Kommentarspalte',
  `capacity` float NOT NULL DEFAULT '0' COMMENT 'Kapazität bei z.B. Löschteich',
  `time_add` datetime DEFAULT NULL,
  `time_update` datetime DEFAULT NULL,
  `user_add` varchar(255) DEFAULT NULL,
  `user_update` varchar(255) DEFAULT NULL,
  `Version` varchar(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`idt1_hydranten`,`type`,`position`),
  KEY `fk_t1_hydranten_t3_type` (`type`),
  KEY `fk_t1_hydranten_t2_position1` (`position`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;");


// Tabelle t2_position
mysql_query("CREATE TABLE IF NOT EXISTS `t2_position` (
  `idt2_position` int(11) NOT NULL,
  `descriptDE` varchar(255) NOT NULL,
  `descriptEN` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`idt2_position`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;");


// Tabelle t3_type
mysql_query("CREATE TABLE IF NOT EXISTS `t3_type` (
  `idt2_type` int(11) NOT NULL,
  `descriptDE` varchar(255) NOT NULL,
  `descriptEN` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`idt2_type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;");


// Daten t2_position
mysql_query("INSERT INTO `t2_position` (`idt2_position`, `descriptDE`, `descriptEN`) VALUES
(1, 'Fahrbahn', NULL),
(2, 'Parkbucht', NULL),
(3, 'Buergersteig', NULL),
(4, 'Wiese/Feld/Wald', NULL);");

// Daten t3_type
mysql_query("INSERT INTO `t3_type` (`idt2_type`, `descriptDE`, `descriptEN`) VALUES
(1, 'Unterflurhydrant', NULL),
(2, 'Schachthydrant', NULL),
(3, 'Oberflurhydrant', NULL),
(4, 'Wandhydrant', NULL),
(5, 'Loeschwasserteich', NULL);");
?>